﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Frame.WcfContract;

namespace Frame.WcfService
{
    public class WcfService : IWcfService
    {
        #region IWcfService 成员

        public byte[] ExecCommandByte(Task task, ref bool result, ref string errMsg)
        {
            task.ObjectResult = DateTime.Now;
            return Frame.Common.ZipSerializable.SerializeObject(task);
        }

        public Task ExecCommandTask(Task task, ref bool result, ref string errMsg)
        {
            try
            {
                Task tempTask = null;
                if (task == null)
                {
                    tempTask = new Task();
                }
                else
                {
                    tempTask = task;
                }

                tempTask.ObjectResult = DateTime.Now;

                result = true;
                return tempTask;
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                result = false;
                return null;
            }
        }

        #endregion
    }
}
